<template>
	<view class="news">
		<navigator hover-class="none"  v-for="(item,i) in news" :key="i" class="news-item" :url="'/subpkg/news_detail/news_detail?newsid='+item.id">
			<block v-if="item.cover == ''">
				<view class="allnewstext">
					<view class="title">{{item.title}}</view>
					<view>
					  <text class="time">{{item.update_time}}</text>
					</view>
				</view>
			</block>
			<block v-else>
				<view class="newsico">
					<image class="newsicoimage" :src="item.cover.indexOf('/public/static/admin/uploads/news/') !== -1  ? portUrl + item.cover :  item.cover" mode="widthFix"></image>
				</view>
				 <view class="newstext">
					<view class="title">{{item.title}}</view>
					<view>
					  <text class="time">{{item.update_time}}</text>
					</view>
				</view>
			</block>
		</navigator>
	</view>
</template>

<script>
	export default {
		name:"news-item",
		props:{
			news:{
				type:Object,
				default:{},
			}
		},
		computed:{
			portUrl:function(){
				return getApp().globalData.portUrl;
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style lang="scss">
	/* 新闻开始 */
	.news .news-item{
	  background-color: #fff;
	  margin-top: 10rpx;
	  min-height: 120rpx;
	  padding: 15rpx 30rpx;
	  position:relative;
	  display: flex;
	  justify-content: space-between;
	  border-radius: 10rpx;
	  margin-bottom:5px;
	}
	.news .news-item .newsico{
	  width: 40%;
	  min-height: 120rpx;
	  position: relative;
	  overflow: hidden;
	  border-radius: 10rpx;
	  display: flex;
	  justify-content: center; /*水平居中*/
	  align-items: center; /*垂直居中*/
	}
	.news .news-item .newsico .newsicoimage{
	   min-height: 120rpx;
	  width: 100%;
	  position: absolute; 
	}
	.news .news-item .allnewstext{
	  width: 100%;
	   min-height: 120rpx;
	  position: relative;
	}
	.news .news-item .newstext{
	  width: 55%;
	  min-height: 120rpx;
	  position: relative;
	}
	.news .news-item .newstext .title,.news .news-item .allnewstext .title{
	  font-size: 25rpx;
	  margin-bottom:20rpx;
	  font-weight: bold;

	}
	.news .news-item .newstext .time,.news .news-item .allnewstext .time{
	  font-size:20rpx;
	  color: rgb(172, 172, 172);
	  bottom: 0rpx;
	  text-align: right;
	}
	/* 新闻结束 */
</style>